package com.zx.cloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zx.cloud.ApiVersion;
import com.zx.cloud.common.filter.CurrentUserId;
import com.zx.cloud.common.filter.IgnoreAuth;
import com.zx.cloud.controller.client.VerifyClient;
import com.zx.cloud.domain.VerifyEntity;
import com.zx.cloud.model.response.ObjectDataResponse;

import io.swagger.annotations.ApiOperation;

/**
 * @Description:
 *
 * @author       Yan Weiwei
 * @Create Time: 2017年11月9日上午9:23:16
 */
@RestController
@RequestMapping(value = ApiVersion.API_V1_PREFIX+"/verify", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, consumes = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public class VerifyController {
	
	@Autowired
	private VerifyClient verifyClient;
	
	@IgnoreAuth
	@ApiOperation(value = "身份OCR认证", notes = "身份OCR认证")
	@RequestMapping(value = "/idcardOcr", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<String> idcardOcr(@CurrentUserId Long userId, @RequestBody VerifyEntity verifyEntity){
		
		ObjectDataResponse<String> data = verifyClient.idcardOcr(verifyEntity);
		
		return data;
	}
	
	@IgnoreAuth
	@ApiOperation(value = "身份活体检测", notes = "身份活体检测")
	@RequestMapping(value = "/checkLiveness", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<String> checkLiveness(@RequestBody VerifyEntity verifyEntity){
		
		ObjectDataResponse<String> data = verifyClient.checkLiveness(verifyEntity);
		
		return data;
	}
}
